package kz.pompei.OneGwt.ifaces.widget;

import java.util.Collection;

import kz.pompei.OneGwt.ifaces.util.Dummy;
import kz.pompei.OneGwt.ifaces.util.Handler;
import kz.pompei.OneGwt.ifaces.util.HandlerKiller;

public class NullAdapters {
  public static TextWidget noTextWidget() {
    return new TextWidget() {
      @Override
      public String get() {
        return "";
      }
      
      @Override
      public void set(String t) {}
      
      @Override
      public HandlerKiller addChangeHandler(Handler hanlder) {
        return Dummy.noKiller();
      }
      
      @Override
      public void setVisible(boolean visible) {}
      
      @Override
      public void setEnabled(boolean enabled) {}
      
      @Override
      public void setFocus(boolean focused) {}
    };
  }
  
  public static <Record> ListWidget<Record> noListWidget() {
    return new ListWidget<Record>() {
      @Override
      public void removeById(String id) {}
      
      @Override
      public void setVisible(boolean visible) {}
      
      @Override
      public void setEnabled(boolean enabled) {}
      
      @Override
      public void setFocus(boolean focused) {}
      
      @Override
      public void addOrUpdate(Record record) {}
      
      @Override
      public void clean() {}
      
      @Override
      public void set(Collection<Record> records) {}
      
      @Override
      public void setStateMessage(StateMessage topMessage) {}
      
      @Override
      public void select(String id) {}
      
      @Override
      public String getSelectedId() {
        return null;
      }
      
      @Override
      public HandlerKiller addChangeSelectionHandler(Handler handler) {
        return Dummy.noKiller();
      }
      
      @Override
      public void scrollToView(String id) {}
    };
  }
  
  public static ButtonWidget noButton() {
    return new ButtonWidget() {
      @Override
      public void setVisible(boolean visible) {}
      
      @Override
      public void setFocus(boolean focused) {}
      
      @Override
      public void setEnabled(boolean enabled) {}
      
      @Override
      public HandlerKiller addClickHandler(Handler handler) {
        return new HandlerKiller() {
          @Override
          public void killHandler() {}
        };
      }
    };
  }
  
  public static BoolWidget noBoolWidget() {
    return new BoolWidget() {
      @Override
      public void set(boolean value) {}
      
      @Override
      public boolean isit() {
        return false;
      }
      
      @Override
      public void setVisible(boolean visible) {}
      
      @Override
      public void setFocus(boolean focused) {}
      
      @Override
      public void setEnabled(boolean enabled) {}
      
      @Override
      public HandlerKiller addChangeHandler(Handler handler) {
        return new HandlerKiller() {
          @Override
          public void killHandler() {}
        };
      }
    };
  }
}
